begintownscript;

variables;

 short choice;
body;
 
beginstate INIT_STATE;
 break;
 
beginstate EXIT_STATE;
 break;
 
beginstate START_STATE;
 
if ((get_flag(4,13) == 1) && (get_flag(20,14) == 1)){ set_terrain(14,12,293);
 
set_terrain(16,12,293);
 play_sound(45);
 
set_flag(4,13,2);
 } if (get_flag(4,15) == 1){ set_state_continue(17);
 }
if (get_flag(4,15) == 2){ set_ticks_forward(16000-get_current_tick());
 set_flag(4,15,3);
 } 
if ((get_flag(4,15) == 3) && (get_current_tick() == 16010)){ print_str_color("Things are starting to degrade,",2);
 print_str_color(" you better get out there quick!",2);
 } 
if ((get_flag(4,15) == 3) && (get_current_tick() == 16020)) { message_dialog("You have spent too much time messing around. You don't get out fast enough.","At least you stoped the Darklings...");
 end_scenario(0);
 } break;
 
beginstate 10;
 if (get_flag(4,10) == 0){ block_entry(1);
 march_party(16,20);
 play_sound(49);
 force_view_center(15,11);
 
force_instant_terrain_redraw();
 
march_party(16,19);
 
force_instant_terrain_redraw();
 
play_sound(49);
 pause(4);
 
march_party(16,18);
 
force_instant_terrain_redraw();
 
play_sound(49);
 pause(4);
 
march_party(15,17);
 
force_instant_terrain_redraw();
 play_sound(49);
 pause(4);
 
march_party(15,16);
 
force_instant_terrain_redraw();
 play_sound(49);
 pause(4);
 
march_party(15,15);
 
force_instant_terrain_redraw();
 play_sound(49);
 pause(4);
 
march_party(15,14);
 
force_instant_terrain_redraw();
 play_sound(49);
 pause(4);
 
text_bubble_on_char(6,"Ha!");
 
force_instant_terrain_redraw();
 
pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(6,"Who knew that");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(6,"you would be so");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(6,"stupid!");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(6,"Now I can");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(6,"sacrifice you directly");
 
force_instant_terrain_redraw();
 
pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(6,"to the Queen!");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(0,"What is your motive?");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(6,"I have talked");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(6,"with my Queen's food");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(6,"long enough.");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(5);
 
set_character_pose(10,1);
 set_character_pose(11,1);
 force_instant_terrain_redraw();
 play_sound(34);
 pause(4);
 
set_character_pose(10,0);
 
set_character_pose(11,0);
 force_instant_terrain_redraw();
 
play_sound(45);
 
set_height(11,9,9);
 
set_height(19,9,9);
 force_instant_terrain_redraw();
 
pause(4);
 
set_character_facing(10,4);
 
set_character_facing(11,4);
 
force_instant_terrain_redraw();
 
set_attitude(6,10);
 
set_attitude(7,10);
 
set_attitude(8,10);
 
set_attitude(9,10);
 
set_attitude(10,10);
 
set_attitude(11,10);
 set_flag(4,10,1);
} break;
 
beginstate 11;
 reset_dialog();
 
add_dialog_str(0,"There is a control panel here, would you like to use it?",0);
 
add_dialog_choice(0,"No.");
 
add_dialog_choice(1,"Use control panel.");
 choice = run_dialog(1);
 if ((get_flag(4,11) == 1) && (choice == 2)){ print_str("Nothing happens.");
 } if ((get_flag(4,11) == 3) && (choice == 2)){ print_str("Nothing happens.");
 } if ((get_flag(4,11) == 5) && (choice == 2)){ print_str("Nothing happens.");
 }
if ((get_flag(4,11) == 0) && (choice == 2)){ print_str_color("The northwest control panel glows.",3);
 play_sound(45);
 set_height(11,9,8);
 set_flag(4,11,1);
 }  if ((get_flag(4,11) == 2) && (choice == 2)){ print_str_color("The northwest control panel glows.",3);
 play_sound(45);
 
set_height(11,9,7);
 set_flag(4,11,3);
 }  if ((get_flag(4,11) == 4) && (choice == 2)){ print_str_color("The northwest control panel glows.",3);
 
play_sound(45);
 
set_height(11,9,6);
 
set_flag(4,11,5);
 }  else
 block_entry(1);
 
break;
 
beginstate 12;
 reset_dialog();
 
add_dialog_str(0,"There is a control panel here, would you like to use it?",0);
 
add_dialog_choice(0,"No.");
 
add_dialog_choice(1,"Use control panel.");
 choice = run_dialog(1);
  if ((get_flag(4,11) == 0) && (choice == 2)){ print_str("Nothing happens.");
 } if ((get_flag(4,11) == 2) && (choice == 2)){ print_str("Nothing happens.");
 } if ((get_flag(4,11) == 4) && (choice == 2)){ print_str("Nothing happens.");
 } if ((get_flag(4,11) == 5) && (choice == 2)){ print_str("Nothing happens.");
 } if ((get_flag(4,11) == 1) && (choice == 2)) { print_str_color("The southwest control panel glows.",3);
 set_flag(4,11,2);
 }  
if ((get_flag(4,11) == 3) && (choice == 2)){ print_str_color("The southwest control panel glows.",3);
 set_flag(4,11,4);
 }   else
 block_entry(1);
  
 break;
 
beginstate 13;
 reset_dialog();
 
add_dialog_str(0,"There is a control panel here, would you like to use it?",0);
 
add_dialog_choice(0,"No.");
 
add_dialog_choice(1,"Use control panel.");
 choice = run_dialog(1);
 if ((get_flag(4,12) == 0) && (choice == 2)){ print_str_color("The northeast control panel glows.",3);
 play_sound(45);
 set_height(19,9,8);
 set_flag(4,12,1);
 } if ((get_flag(4,12) == 1) && (choice == 2)){ print_str("Nothing happens.");
 } if ((get_flag(4,12) == 2) && (choice == 2)){ print_str_color("The northeast control panel glows.",3);
 play_sound(45);
 
set_height(19,9,7);
 set_flag(4,12,3);
 } if ((get_flag(4,12) == 3) && (choice == 2)){ print_str("Nothing happens.");
 } if ((get_flag(4,12) == 4) && (choice == 2)){ print_str_color("The northeast control panel glows.",3);
 
play_sound(45);
 
set_height(19,9,6);
 
set_flag(4,12,5);
 } if ((get_flag(4,12) == 5) && (choice == 2)){ print_str("Nothing happens.");
 } else
 block_entry(1);
 
break;beginstate 14;
 reset_dialog();
 
add_dialog_str(0,"There is a control panel here, would you like to use it?",0);
 
add_dialog_choice(0,"No.");
 
add_dialog_choice(1,"Use control panel.");
 choice = run_dialog(1);
  if ((get_flag(4,12) == 0) && (choice == 2)){ print_str("Nothing happens.");
 } if ((get_flag(4,12) == 1) && (choice == 2)) { print_str_color("The southeast control panel glows.",3);
 set_flag(4,12,2);
 } if ((get_flag(4,12) == 2) && (choice == 2)){ print_str("Nothing happens.");
 } 
if ((get_flag(4,12) == 3) && (choice == 2)){ print_str_color("The southeast control panel glows.",3);
 set_flag(4,12,4);
 } if ((get_flag(4,12) == 4) && (choice == 2)){ print_str("Nothing happens.");
 } if ((get_flag(4,12) == 5) && (choice == 2)){ print_str("Nothing happens.");
 } else
 block_entry(1);
  
 break;
 
beginstate 15;
 reset_dialog();
 
add_dialog_str(0,"There is a lever here, do you want to use it?",0);
 
add_dialog_choice(0,"No.");
 
add_dialog_choice(1,"Use lever.");
 choice = run_dialog(1);
 if ((get_flag(4,13) == 1) && (choice == 1)){ print_str("Nothing happens.");
   } if ((get_flag(4,13) == 0) && (choice == 2)){ print_str_color("You hear chains rattling around you.",3);
 set_terrain(11,9,375);
  
set_flag(4,13,1);
 }  break;
 
beginstate 16;
 reset_dialog();
 
add_dialog_str(0,"There is a lever here, do you want to use it?",0);
 
add_dialog_choice(0,"No.");
 
add_dialog_choice(1,"Use lever.");
 choice = run_dialog(1); if ((get_flag(20,14) == 1) && (choice == 1)){ print_str("Nothing happens.");

 } if ((get_flag(20,14) == 0) && (choice == 2)){ print_str_color("You hear chains rattling around you.",3);
 set_terrain(19,9,375);
  
set_flag(20,14,1);
 }    break;
 
beginstate 17;
 if (get_flag(4,15) == 1){ message_dialog("As the Queen of the Darklings falls apart on itself, a sort of mist comes from you and enters the queen.","The queen then stops still, and suddenly explodes.");
 
pause(8);
 
text_bubble_on_char(6,"No!");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(6,"This will not be the end!");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(6,"The Darklings");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(6,"will not perish!");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
put_boom_on_char(6,2,0);
 run_animation();
 play_sound(10);
 
erase_char(6);
 pause(8);
 
activate_hidden_group(1);
 
relocate_character(12,15,10);
 force_instant_terrain_redraw();
  
put_boom_on_char(12,2,0);
 run_animation();
 play_sound(10);
 pause(8);
 
text_bubble_on_char(12,"You will not");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(12,"leave here");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(12,"ali...");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(12,".");
 
force_instant_terrain_redraw();
 pause(5);
 erase_text_bubbles();text_bubble_on_char(12,"..");
 
force_instant_terrain_redraw();
 pause(5);
 erase_text_bubbles();
 
text_bubble_on_char(12,"...");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(3);
 
text_bubble_on_char(12,"Oh shit...");
 
force_instant_terrain_redraw();
 pause(8);
 erase_text_bubbles();
 pause(8);
 set_terrain(15,10,126);
 
erase_char(12);
 play_sound(5);
 pause(8);
 message_dialog("Too bad you never got a chance to get to know him or his motive. Oh well.","Oh crap...this dimension is destabilizing. It would be a good idea to run right now.");
 
message_dialog("It is recommended that you run in combat mode.","");
 set_flag(4,15,2);
 } break;
 
beginstate 18;
 if ((get_flag(4,15) == 0) || (get_flag(4,15) == 1)){ message_dialog("You've gone this far. There is no backing out now!","");
 block_entry(1);
 } break;
 
beginstate 19;
 
if (get_flag(4,15) == 3){ move_to_new_town(14,23,21);
 } break;
 